greenfoot Class MouseInfo
java.lang.Object
greenfoot.MouseInfo



public class MouseInfo extends java.lang.ObjectThis class contains information about the current status of the mouse. You can get a MouseInfo object via Greenfoot. getMouseInfo().
得到鼠标信息对象,包括数据和方法。


Version:
2.1
Author:
Poul Henriksen
See Also:
Greenfoot.#getMouseInfo()



没有构造方法,
只有
Method Summary

Actor getActor() 得到和鼠标动作相关的对象
Return the actor (if any) that the current mouse behaviour is related to.

int getButton() 得到点击过的按钮数目
The number of the pressed or clicked button (if any).
int getClickCount() 得到鼠标点击数
Return the number of mouse clicks associated with this mouse event.

int getX() 得到鼠标游标的x轴位置
Return the current x position of the mouse cursor.

int getY() 得到鼠标游标的y轴位置
Return the current y position of the mouse cursor.
java.lang.String toString()


下面的都很没意思

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait


Method Detail
getX
public int getX()Return the current x position of the mouse cursor.

Returns:
the x position in grid coordinates


getY
public int getY()Return the current y position of the mouse cursor.

Returns:
the y position in grid coordinates


getActor
public Actor getActor()Return the actor (if any) that the current mouse behaviour is related to. If the mouse was clicked or pressed the actor it was clicked on will be returned. If the mouse was dragged or a drag ended, the actor where the drag started will be returned. If the mouse was moved, it will return the actor that the mouse is currently over.

Returns:
Actor that the current mouse behaviour relates to, or null if there is no actor related to current behaviour.


getButton
public int getButton()The number of the pressed or clicked button (if any).

Returns:
The button number. Usually 1 is the left button, 2 is the middle button and 3 is the right button.


getClickCount
public int getClickCount()Return the number of mouse clicks associated with this mouse event.

Returns:
The number of times a button has been clicked.


toString
public java.lang.String toString()Overrides:
toString in class java.lang.Object